package logic

import (
	"context"
	"user-management/models/mysql"

	"user-management/userrpc/internal/svc"
	"user-management/userrpc/userrpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type DelLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewDelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DelLogic {
	return &DelLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 删除
func (l *DelLogic) Del(in *userrpc.DelRequest) (*userrpc.DelResponse, error) {
	// todo: add your logic here and delete this line

	mysql.DB.Debug().Where("id = ?", in.Id).Delete(&mysql.User{})

	return &userrpc.DelResponse{}, nil
}
